/*
 * @Descripttion: 判断医师是否在线
 * @version: 1.0
 * @Author: 自由如风
 * @Date: 2021-05-06 19:52:55
 * @LastEditors: 自由如风
 * @LastEditTime: 2021-05-06 20:31:59
 */
const { DOCTOR } = require('../../lib/Identity');
const { Fail } = require('../../lib/Response');

module.exports = async function (ctx, next) {
    if (!!ctx.session.doctor && !!ctx.session.doctor.id && ctx.session.doctor.identity == DOCTOR) {
        await next();
    } else {
        ctx.body = new Fail('你当前不在线，或身份不是医师。')
    }
}
